
import { getStatusText, formatTime, toFixedHandle } from '@/utils/tools'

// 列表项配置
export const columnItemsTableHandle = (currency_options = [], write_status_options = []) => [
  {
    label: '序号',
    prop: '',
    width: '80',
    align: 'center',
    type: 'text',
    formatter: (row, column, countryCode, index) => {
      return index + 1
    }
  },
  {
    label: '回款单号',
    prop: 'paymentPlanOrderNo',
    width: '200',
    align: 'center',
    type: 'text',
    slot: 'name'
  },
  {
    label: '回款单现金金额',
    prop: 'paymentAmount',
    width: '',
    align: 'center',
    type: 'text',
    formatter: (row, column, paymentAmount, index) => {
      return toFixedHandle(paymentAmount)
    }
  },
  {
    label: '币种',
    prop: 'currencyCode',
    width: '',
    align: 'center',
    type: 'text',
    formatter: (row, column, currencyCode, index) => {
      return getStatusText(currencyCode, currency_options) || '--'
    }
  },
  {
    label: '回款流水号',
    prop: 'transactionFlowNo',
    width: '',
    align: 'center',
    type: 'text'
  },
  {
    label: '最终主体',
    prop: 'finalPayeeName',
    width: '',
    align: 'center',
    type: 'text'
  },
  {
    label: '最终币种',
    prop: 'finalCurrency',
    width: '',
    align: 'center',
    type: 'text',
    formatter: (row, column, finalCurrency, index) => {
      return getStatusText(finalCurrency, currency_options) || '--'
    }
  },
  {
    label: '流水最终金额',
    prop: 'bankSlipAmount',
    width: '',
    align: 'center',
    type: 'text',
    formatter: (row, column, bankSlipAmount, index) => {
      return toFixedHandle(bankSlipAmount)
    }

  },
  {
    label: '本次核销金额',
    prop: 'writeOffAmount',
    width: '',
    align: 'center',
    type: 'text',
    formatter: (row, column, writeOffAmount, index) => {
      return toFixedHandle(writeOffAmount)
    }

  },
  {
    label: '核销时间',
    prop: 'updateTime',
    width: '',
    align: 'center',
    type: 'text',
    formatter: (row, column, updateTime, index) => {
      return formatTime(updateTime)
    }
  },
  {
    label: '核销申请人',
    prop: 'writeOffInitiatorName',
    width: '',
    align: 'center',
    type: 'text',
    formatter: (row, column, writeOffInitiatorName, index) => {
      return writeOffInitiatorName === '-1' ? '未找到邮箱' : writeOffInitiatorName
    }
  },
  {
    label: '状态',
    prop: 'status',
    width: '',
    align: 'center',
    type: 'text',
    formatter: (row, column, status, index) => {
      return getStatusText(status, write_status_options) || '--'
    }
  }
]
